//
//  GYAuthStatuViewModel.m
//  GYDemo
//
//  Created by Mrzhang on 2018/5/23.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "GYAuthStatuViewModel.h"
#import "Head.h"
@implementation GYAuthStatuViewModel
-(instancetype)init
{
    if (self = [super init]) {
        //添加接口特殊处理
        [[InterfaceManager shareInterface].specialInterfaces addObject:@"usercheckAuth"];
    }
    return self;
}
+(void)requestCheckAuth:(statusHandle)handel
{
    NSString *interface =[[GYLoginViewModel shareInterface] roleType]==1?@"usercheckAuth":[[GYLoginViewModel shareInterface] roleType]==2?@"storageCheckAuth":@"LogisticsCheckAuth";
    [[InterfaceManager shareInterface]requetInterface:interface withParameter:nil handler:^(NSDictionary *info, InterfaceStatusModel *infoModel) {
        NSString *userCompanyAuthoStatus = [NSString stringWithFormat:@"%ld",infoModel.status];
        // [selfp setUserCompanyAuthoStatus:userCompanyAuthoStatus];
        
        if ([[GYLoginViewModel shareInterface] roleType]==1)
        {
            [[GYUserViewModel shareInterface] setUserCompanyAuthoStatus:userCompanyAuthoStatus];
        }else
        {
            [[GYStorageUserViewModel shareInterface] setUserCompanyAuthoStatus:userCompanyAuthoStatus];
        }
        
        if ([userCompanyAuthoStatus integerValue]==1)
        {
            [FTIndicator showErrorWithMessage:@"您还不是认证用户,请在""我的""--""企业认证信息""处认证"];
        }
        if ([userCompanyAuthoStatus integerValue]==2)
        {
            [FTIndicator showErrorWithMessage:@"您的账号异常,请联系客服"];
        }
        if ([userCompanyAuthoStatus integerValue]==3)
        {
            [FTIndicator showErrorWithMessage:@"您提交的认证申请正在审核中,请耐心等待"];
        }
        if ([userCompanyAuthoStatus integerValue]==4)
        {
            [FTIndicator showErrorWithMessage:@"您提交的认证申请被拒绝"];
        }
        if ([userCompanyAuthoStatus integerValue]==0)
        {
             handel(userCompanyAuthoStatus);
        }
        
    }];
}

@end
